#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long LL;
const int N = 2e5 + 10;
LL s[N];
int main()
{
	int t;
	cin >> t;
	while (t--) {
		memset(s, 0, sizeof(s));
		int n, k;
		cin >> n >> k;
		for (int i = 1; i <= n; i++) {
			cin >> s[i];
			s[i] += s[i - 1];
		}
		LL ma = -1e18;
		LL sum = -1e18;
		for (int i = 1; i + k <= n; i++) {
			if (i - k >= 0) {
				ma = max(ma, s[i] - s[i - k]);
			}
			sum = max(sum, ma + s[i + k] - s[i]);
		}
		cout << sum << endl;
	}
	return 0;
}